home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / gtksourceview-1.0 / language-specs / language.rng < prev    next >
Encoding:
Extensible Markup Language  |  2007-03-11  |  10.0 KB  |  352 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   This file describes the XML format used for syntax highlight
  4.   descriptions for the GtkSourceView 1.x library.
  5.   
  6.   .lang files are XML files which describe how to highlight syntax;
  7.   this RNG is used for validation purposes.
  8.   
  9.   .lang files should be located in $PREFIX/gtksourceview-1.0/language-specs/, 
  10.   or in ~./gnome2/gtksourceview-1.0/language-specs/
  11.   
  12.   To check if a .lang file is valid, run
  13.   
  14.   $ xmllint FILENAME - -relaxng language.rng
  15.   
  16.   If you create a new .lang file or modify an existing one, please note
  17.   that it will be (re)loaded by the application only after it is
  18.   restarted.
  19. -->
  20. <!--
  21.   Boolean type
  22.   
  23.   Attributes that are of type boolean allow the following values:
  24.   
  25.   - 'true', 'TRUE' and '1'     all meaning true
  26.   - 'false', FALSE' and '0'     all meaning false
  27.   
  28.   It is encouraged to use 'TRUE' and 'FALSE' instead of the alternatives.
  29. -->
  30. <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" 
  31.          xmlns="http://relaxng.org/ns/structure/1.0"
  32.          datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  33.   <define name="boolean">
  34.     <choice>
  35.       <value>true</value>
  36.       <value>false</value>
  37.       <value>TRUE</value>
  38.       <value>FALSE</value>
  39.       <value>0</value>
  40.       <value>1</value>
  41.     </choice>
  42.   </define>
  43.   <!--
  44.     Attributes required by all element representing a syntax or pattern tag.
  45.     
  46.     - name        the name of the tag (it can appear in the UI)
  47.     
  48.     - style        the style used to highlight the tag. Recognized values
  49.             are (from gtksourcestylescheme.h):
  50.     
  51.             - Base-N Integer    used for values with a base
  52.                         other than 10
  53.             - Character        used for single characters
  54.             - Comment        used for comments
  55.             - Data Type        used for data types
  56.             - Function        used for function names
  57.             - Decimal        used for decimal values
  58.             - Floating Point    used for floating point values
  59.             - Keyword        used for keywords
  60.             - Preprocessor        used for preprocessor instructions
  61.             - String        used for strings
  62.             - Specials        used for 'special' things
  63.             - Others (DEPRECATED, replaced by "Data Type")
  64.             - Others 2        used for 'other' things
  65.             - Others 3        used for 'other' things
  66.     
  67.     The "name" attribute can be prefixed with "_" to be marked for
  68.     translation.
  69.   -->
  70.   <define name="tagattrs">
  71.     <choice>
  72.       <attribute name="_name">
  73.         <data type="string"/>
  74.       </attribute>
  75.       <attribute name="name">
  76.         <data type="string"/>
  77.       </attribute>
  78.     </choice>
  79.     <attribute name="style">
  80.       <data type="string"/>
  81.     </attribute>
  82.   </define>
  83.   <!--
  84.     The root of the definition file is the element "language".
  85.     
  86.     Required attributes:
  87.     
  88.     - name        the name of the language (it can appear in menus and
  89.             dialog boxes)
  90.     
  91.     - section    the category the language belongs to (e.g. "Sources",
  92.             "Scripts", etc.)
  93.     
  94.     - version    version of the .lang file format (1.0)
  95.     
  96.     - mimetypes    a list of mime-types that identifies the types of file
  97.             that must be highlighted using the .lang file
  98.     
  99.     Optional attributes:
  100.     
  101.     - translation-domain
  102.             the translation domain used by the file
  103.     
  104.     The "name" and "section" attributes can be prefixed with
  105.     "_" to be marked for translation.
  106.   -->
  107.   <define name="language">
  108.     <element name="language">
  109.       <ref name="attlist.language"/>
  110.       <optional>
  111.         <ref name="escape-char"/>
  112.       </optional>
  113.       <oneOrMore>
  114.         <choice>
  115.           <ref name="line-comment"/>
  116.           <ref name="block-comment"/>
  117.           <ref name="string"/>
  118.           <ref name="syntax-item"/>
  119.           <ref name="pattern-item"/>
  120.           <ref name="keyword-list"/>
  121.         </choice>
  122.       </oneOrMore>
  123.     </element>
  124.   </define>
  125.   
  126.   <define name="attlist.language" combine="interleave">
  127.     <choice>
  128.       <attribute name="_name">
  129.         <data type="string"/>
  130.       </attribute>
  131.       <attribute name="name">
  132.         <data type="string"/>
  133.       </attribute>
  134.     </choice>
  135.     <choice>
  136.       <attribute name="_section">
  137.         <data type="string"/>
  138.       </attribute>
  139.       <attribute name="section">
  140.         <data type="string"/>
  141.       </attribute>
  142.     </choice>
  143.     <attribute name="version">
  144.       <data type="string">
  145.         <param name="pattern">1\.0</param>
  146.       </data>
  147.     </attribute>
  148.     <attribute name="mimetypes"/>
  149.     <optional>
  150.       <attribute name="translation-domain"/>
  151.     </optional>
  152.   </define>
  153.   <!-- Which character is used in escape sequences. -->
  154.   <define name="escape-char">
  155.     <element name="escape-char">
  156.       <ref name="attlist.escape-char"/>
  157.       <text/>
  158.     </element>
  159.   </define>
  160.   <define name="attlist.escape-char" combine="interleave">
  161.     <empty/>
  162.   </define>
  163.   <!--
  164.     The line-comment" element represents single line comments.
  165.     The "start-regex" subelement defines the regex matching the start of
  166.     the comment.
  167.   -->
  168.   <define name="line-comment">
  169.     <element name="line-comment">
  170.       <ref name="attlist.line-comment"/>
  171.       <ref name="start-regex"/>
  172.     </element>
  173.   </define>
  174.   <define name="attlist.line-comment" combine="interleave">
  175.     <ref name="tagattrs"/>
  176.   </define>
  177.   <!--
  178.     The "block-comment" element represents multiple lines comments.
  179.     The "start-regex" subelement defines the regex matching the beginning of
  180.     the comment.
  181.     The "end-regex" subelement defines the regex matching the end of
  182.     the comment.
  183.   -->
  184.   <define name="block-comment">
  185.     <element name="block-comment">
  186.       <ref name="attlist.block-comment"/>
  187.       <ref name="start-regex"/>
  188.       <ref name="end-regex"/>
  189.     </element>
  190.   </define>
  191.   <define name="attlist.block-comment" combine="interleave">
  192.     <ref name="tagattrs"/>
  193.   </define>
  194.   <!--
  195.     The "string" element represents string.
  196.     The "start-regex" subelement defines the regex matching the beginning of
  197.     the string.
  198.     The "end-regex" subelement defines the regex matching the end of
  199.     the string.
  200.     
  201.     Optional attributes:
  202.     
  203.     - end-at-line-end    whether the string end at the end of line
  204.   -->
  205.   <define name="string">
  206.     <element name="string">
  207.       <ref name="attlist.string"/>
  208.       <ref name="start-regex"/>
  209.       <ref name="end-regex"/>
  210.     </element>
  211.   </define>
  212.   <define name="attlist.string" combine="interleave">
  213.     <ref name="tagattrs"/>
  214.     <optional>
  215.       <attribute name="end-at-line-end" a:defaultValue="TRUE">
  216.         <ref name="boolean"/>
  217.       </attribute>
  218.     </optional>
  219.   </define>
  220.   <!--
  221.     The "syntax-item" element represents a generic region of the document.
  222.     The "start-regex" subelement defines the regex matching the beginning of
  223.     the region.
  224.     The "end-regex" subelement defines the regex matching the end of
  225.     the region.
  226.   -->
  227.   <define name="syntax-item">
  228.     <element name="syntax-item">
  229.       <ref name="attlist.syntax-item"/>
  230.       <ref name="start-regex"/>
  231.       <ref name="end-regex"/>
  232.     </element>
  233.   </define>
  234.   <define name="attlist.syntax-item" combine="interleave">
  235.     <ref name="tagattrs"/>
  236.   </define>
  237.   <!--
  238.     The "pattern-item" element represents a generic token.
  239.     The "regex" subelement defines the regex matching the token.
  240.   -->
  241.   <define name="pattern-item">
  242.     <element name="pattern-item">
  243.       <ref name="attlist.pattern-item"/>
  244.       <ref name="regex"/>
  245.     </element>
  246.   </define>
  247.   <define name="attlist.pattern-item" combine="interleave">
  248.     <ref name="tagattrs"/>
  249.   </define>
  250.   <!--
  251.     The "keyword-list" element represents a list of keywords, it can have
  252.     one or more "keyword" subelements each one representing a keyword.
  253.     A "keyword" subelement defines the regex matching a keyword of the
  254.     language.
  255.     
  256.     Optional attributes:
  257.     
  258.     - case-sensitive    whether the keywords are case sensitive
  259.     
  260.     - match-empty-string-at-beginning:
  261.                 whether the empty string (\b) should be matched
  262.                 at the beginning of the keywords
  263.     
  264.     - match-empty-string-at-end
  265.                 whether the empty string (\b) should be matched
  266.                 at the end of the keywords
  267.     
  268.     - beginning-regex    if all keywords start with a regex, you can
  269.                 specify    it here to avoid doing it for
  270.                 every single keyword
  271.     
  272.     - end-regex        if all keywords end with a regex, you can
  273.                 specify    it here to avoid doing it for
  274.                 every single keyword
  275.   -->
  276.   <define name="keyword-list">
  277.     <element name="keyword-list">
  278.       <ref name="attlist.keyword-list"/>
  279.       <oneOrMore>
  280.         <ref name="keyword"/>
  281.       </oneOrMore>
  282.     </element>
  283.   </define>
  284.   <define name="attlist.keyword-list" combine="interleave">
  285.     <ref name="tagattrs"/>
  286.     <optional>
  287.       <attribute name="case-sensitive" a:defaultValue="TRUE">
  288.         <ref name="boolean"/>
  289.       </attribute>
  290.     </optional>
  291.     <optional>
  292.       <attribute name="match-empty-string-at-beginning" a:defaultValue="FALSE">
  293.         <ref name="boolean"/>
  294.       </attribute>
  295.     </optional>
  296.     <optional>
  297.       <attribute name="match-empty-string-at-end" a:defaultValue="FALSE">
  298.         <ref name="boolean"/>
  299.       </attribute>
  300.     </optional>
  301.     <optional>
  302.       <attribute name="beginning-regex"/>
  303.     </optional>
  304.     <optional>
  305.       <attribute name="end-regex"/>
  306.     </optional>
  307.   </define>
  308.   <!-- Elements used inside other elements -->
  309.   <define name="keyword">
  310.     <element name="keyword">
  311.       <ref name="attlist.keyword"/>
  312.       <text/>
  313.     </element>
  314.   </define>
  315.   <define name="attlist.keyword" combine="interleave">
  316.     <empty/>
  317.   </define>
  318.   <define name="regex">
  319.     <element name="regex">
  320.       <ref name="attlist.regex"/>
  321.       <text/>
  322.     </element>
  323.   </define>
  324.   <define name="attlist.regex" combine="interleave">
  325.     <empty/>
  326.   </define>
  327.   <define name="start-regex">
  328.     <element name="start-regex">
  329.       <ref name="attlist.start-regex"/>
  330.       <text/>
  331.     </element>
  332.   </define>
  333.   <define name="attlist.start-regex" combine="interleave">
  334.     <empty/>
  335.   </define>
  336.   <define name="end-regex">
  337.     <element name="end-regex">
  338.       <ref name="attlist.end-regex"/>
  339.       <text/>
  340.     </element>
  341.   </define>
  342.   <define name="attlist.end-regex" combine="interleave">
  343.     <empty/>
  344.   </define>
  345.   
  346.   <start>
  347.     <choice>
  348.       <ref name="language"/>
  349.     </choice>
  350.   </start>
  351. </grammar>
  352.